<template>
  <f7-page>

    <f7-navbar title="提现设置" back-link="返回">
    </f7-navbar>
    <f7-list form>
		<f7-list-item>
			<f7-label>物流管理员(%)</f7-label>
			<f7-input :value="obj.traffic_employee" @input="obj.traffic_employee=$event.target.value" name="traffic_employee" type="text" placeholder=""></f7-input>
		</f7-list-item>

    <f7-list-item>
      <f7-label>外部合作车队(%)</f7-label>
      <f7-input :value="obj.traffic_captain" @input="obj.traffic_captain=$event.target.value" name="traffic_captain" type="text" placeholder=""></f7-input>
    </f7-list-item>

		<f7-list-item>{{obj}}</f7-list-item>
	</f7-list>
  <f7-list-button class="bar bar-royal">
        <h1 class="title" @click="savePercentageCash">确认修改</h1>
    </f7-list-button>

    <commitchart></commitchart>
  </f7-page>
</template>

<script>
import commitchart from '../../components/commitchart'
  export default {
    name: 'trafficTixiansetSu',
    data () {
      return {
      	obj:{
          traffic_employee:'',
          traffic_captain:''
        }
      }
    },
    components: {
      commitchart
    },
    methods: {
    	hello(x,y){
    		console.log('开始',x,y)
    	},
      update(){
        console.log('update', this.name)
      }
      // 获取 /percentage_cash/get_one
      , async getPercentageCash(){
        let result = (await this.mineService.getPercentageCash({})).data.data;
        if(result && result._id){
          this.obj.traffic_employee=result.traffic_employee;
          this.obj.traffic_captain = result.traffic_captain;
        }

      }
      // 设置 /percentage_cash/save_percentage
      , async savePercentageCash(){
        if(! Number(this.obj.traffic_employee)){
          alert('不是数字')
        }
        if(! Number(this.obj.traffic_captain)){
          alert('不是数字')
        }
        let result = (await this.mineService.savePercentageCash(this.obj)).data.data
        if(result && result._id){
          alert('修改成功')
        }
          console.log('save_result', result)
      }
    },
    mounted () {
        this.getPercentageCash()
      }
  }
</script>

<style scoped>
  .row {
    margin: 0px 10px;
  }

  .col-25 {
    float: left;
    text-align: center;
    position: relative;
    margin-bottom: 25px;
  }

  i.f7-icons {
    display: inherit;
    height: 30px;
  }

  .text-gray {
    font-family: verdana, 'Hiragino Sans GB', 'Microsoft Yahei', 微软雅黑,
    'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    font-weight: 400;
    margin-top: 7px;
    font-size: 12px;
  }

  .text-purple {
    color: #a3a2f0;
  }

  .ios .navbar .right {
    margin-left: 10px;
    color: #fff;
    font-size: 14px;
  }

  .bg-master {
    position: relative;
    background: url('../../assets/img/bg-master.jpg') no-repeat center -53px;
    background-size: 100% 150px;
    padding-bottom: 15px;
  }

  .bg-master h2 {
    color: #fff;
    font-size: 20px;
    white-space: normal;
    display: inherit;
    padding: 12px 0 9px 24px;
    margin: 0;
  }

  .bg-master h4 {
    color: #fff;
    font-size: 12px;
    white-space: normal;
    display: inherit;
    padding: 0px 0 30px 24px;
    margin: 0;
  }

  .role-icon {
    vertical-align: middle;
    background: #9db7ff;
    color: #fff;
    font-size: 12px;
    border-radius: 20px;
    padding: 2px 8px;
    margin-left: 10px;
  }

  .logo-icon {
    position: absolute;
    right: 24px;
    top: 9px;
    width: 80px;
    height: 80px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 100%;
    background: #f0f0f0;
  }

  .logo-icons {
    width: 48px;
    height: 48px;
    border-radius: 100%;
  }

  .ios .card {
    margin: 0 24px 20px 24px;
    padding: 10px 10px;
    border-radius: 5px;
  }

  .text-center_tite {
    font-size: 16px;
    color: #333;
  }

  .text-center_footer {
    font-size: 12px;
    color: #666;
  }

  .text-center_footer span {
    margin-right: 3px;
  }

  .ios .card-header,
  .ios .card-footer {
    min-height: 40px;
    padding: 0px 15px;
    position: initial;
  }

  .item-face {
    position: absolute;
    right: 15px;
    top: 5px;
  }

  .text-gray2 {
    color: #e5e5e5;
    font-size: 12px;
    display: inherit;
  }

  .ios .list {
    margin: 0;
  }

  .ios .page {
    background: #fff;
  }
</style>
